<?php $birthday = explode('-', $this->data['birthday']); ?>
<script type="text/javascript">
    $(document).ready(function(){
        loadYear(<?php echo $birthday[0]; ?>);
        loadMonth(<?php echo $birthday[1]; ?>);
        loadDay(<?php echo $birthday[2]; ?>);
    });

     function valid_profile() {
        var fullname = $('#fullname').val();
        var countError = 0;
        
        if(fullname == '') {
            $('#errorFullname').html('Tên đầy đủ không được để trống');
            countError++
        }
        else if((fullname.length > 50) || (fullname.length < 5)) {
            $('#errorFullname').html('Tên đầy đủ có độ dài 5-50 kí tự');
            countError++;
        }
        else {
            var reg = /[a-zA-ZÀÁÂÃÈÉÊÌÍÒÓÔÕÙÚĂĐĨŨƠàáâãèéêìíòóôõùúăđĩũơƯĂẠẢẤẦẨẪẬẮẰẲẴẶẸẺẼỀỀỂưăạảấầẩẫậắằẳẵặẹẻẽềềểỄỆỈỊỌỎỐỒỔỖỘỚỜỞỠỢỤỦỨỪễệỉịọỏốồổỗộớờởỡợụủứừỬỮỰỲỴÝỶỸửữựỳỵỷỹ ]+$/;
            if(reg.test(fullname) == false) {
                $('#errorFullname').html('Tên đầy đủ gồm các kí tự chữ cái, không chứa chữ số');
                countError++;
            }
            else {
                $('#errorFullname').html('');
            }
        }
        if(countError > 0) {
            return false;
        }
        else {
            return true;
        }
     }
</script>
<div class="heading">
    <div class="left_heading"></div>

    <div class="content_heading">
        <h3>Thông tin tài khoản</h3>
    </div>

    <div class="right_heading"></div>
</div><!-- End .heading -->

<div class="main_content">
    <form action="" method="post" enctype="multipart/form-data" onsubmit="return valid_profile()">      
        <table class="table_content">
            <tr>
                <td class="label" style="color: #000000;">Thông tin tài khoản</td>
                <td class="label2">&nbsp;</td>
                <td></td>
            </tr>
            <tr>
            	<td class="label"><?php echo $this->formLabel('email', 'Địa chỉ Email'); ?></td>
            	<td class="label2"><?php echo $this->data['email']; ?></td>
            	<td><span class="msg"><?php echo $this->errorEmail; ?></span></td>
            </tr>
            <tr>
            	<td class="label"><?php echo $this->formLabel('level', 'Quyền hạn'); ?></td>
            	<td class="label2"><?php echo $this->formSelect('level', $this->data['level'], 
                    array('id' => 'level', 'class' => 'input', 'disabled' => 'true'),
          			array('0' => 'Quản trị', '1' => 'Nhân viên', '2' => 'Thành viên')); ?></td>
            	<td></td>
            </tr>
            <tr>
            	<td class="label"><?php echo $this->formLabel('status', 'Trạng thái'); ?></td>
            	<td class="label2"><?php echo $this->formSelect('status', $this->data['status'], 
                    array('id' => 'level', 'class' => 'input', 'disabled' => 'true'),
          			array('1' => 'Hoạt động', '0' => 'Khóa')); ?></td>
            	<td></td>
            </tr>
            <tr>
                <td>&nbsp;</td>
                <td>&nbsp;</td>
                <td></td>
            </tr>
            <tr>
                <td class="label" style="color: #000000;">Thông tin cá nhân</td>
                <td class="label2">&nbsp;</td>
                <td></td>
            </tr>
            <tr>
                <td class="label"><?php echo $this->formLabel('fullname', 'Tên đầy đủ'); ?><span class="msg"> * </span></td>
                <td class="label2"><?php echo $this->formText('fullname', $this->data['fullname'], array('id' => 'fullname', 'class' => 'input')); ?></td>
                <td><span class="msg" id="errorFullname"><?php echo $this->errorFullname; ?></span></td>
            </tr>
            <tr>
                <td class="label"><?php echo $this->formLabel('gender', 'Giới tính'); ?></td>
                <td class="label2">
                    <?php echo $this->formSelect('gender', $this->data['gender'], array(
                        'id' => 'gender',
                        'class' => 'input'),
                            array(
                                '1' => 'Nam',
                                '2' => 'Nữ',
                    )); ?>
                </td>
                <td></td>
            </tr>
            <tr>
                <td class="label"><?php echo $this->formLabel('day', 'Ngày sinh'); ?></td>
                <td class="label2">
                    <select class="input" style="width: 55px;" name="day" id="day">
                        
                    </select>
                    <select class="input" style="width: 55px;" name="month" id="month" onchange="loadDay()"></select>
                    <select class="input" style="width: 80px;" name="year" id="year" onchange="loadDay()"></select>
                </td>
                <td>Ngày / Tháng / Năm</td>
            </tr>
            <tr>
                <td class="label"><?php echo $this->formLabel('avatar', 'Ảnh đại diện'); ?></td>
				<td class="label2">
                <?php if($this->data['avatar'] != '0') : ?>
				<img src="<?php echo $this->baseUrl('/public/files/user/') . $this->data['avatar']; ?>" width="40px" height="40px" style="float: left;" data-tooltip="sticky<?php echo $this->data['user_id']; ?>">
				<?php else : ?>
				<img src="<?php echo $this->baseUrl('/public/files/user/'); ?>no-avatar.gif" width="40px" height="40px" style="float: left;" data-tooltip="sticky<?php echo $this->data['user_id']; ?>">
				<?php endif; ?>
				<?php echo $this->formSubmit('delImg', 'Hủy ảnh', array('class' => 'button', 'style' => 'margin-left: 10px; margin-top: 0px; float: left; position: relative;', 'onclick' => 'return del_img()')); ?>
                </td>
            </tr>
            <tr>
                <td class="label"><?php echo $this->formLabel('avatar', 'Ảnh mới (nếu có)'); ?></td>
				<td class="label2"><?php echo $this->formFile('avatar', array('id' => 'avatar', 'class' => 'input')); ?></td>
				<td><span class="msg"><?php echo $this->errorAvatar; ?></span></td>
            </tr>
            <tr>
                <td>&nbsp;</td>
                <td colspan="2"><span class="msg"><?php echo $this->error; ?></span></td>
            </tr>
            <tr>
                <td class="label">&nbsp;</td>
                <td>
                    <input class="button" type="submit" name="submit" value="Cập nhật"/>
					<input class="button" type="reset" name="reset" value="Nhập lại"/>
                </td>
                <td></td>
            </tr>
        </table>
    </form>
    <div id="mystickytooltip" class="stickytooltip">
	    <div id="sticky<?php echo $this->data['user_id']; ?>" class="atip" style="width:auto; height:auto; text-align:center;">
            <?php if($this->data['avatar'] != '0') : ?>
	    	<img style="width: 250px; height: 250px; text-align:center;" src="<?php echo $this->baseUrl('/public/files/user/') . $this->data['avatar']; ?>">
            <?php else : ?>
            <img style="width: 250px; height: 250px; text-align:center;" src="<?php echo $this->baseUrl('/public/files/user/'); ?>no-avatar.gif">
            <?php endif; ?>
	    </div>
    </div>
</div><!-- End .main_content -->  